
package ui.adapter;

import android.content.Context;
import android.graphics.Color;
import android.widget.TextView;

import net.ck.hzq.R;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import Utils.StringUtil;
import base.BaseViewHolder;
import base.SuperBaseAdapter;
import ui.model.RewardsChallengeBean;
import util.SysUtils;


/**
 * 新钱包奖励适配器
 * Created by chenjian on 19/2/27.
 */
public class RewardsDetailsChallengeAdapter extends SuperBaseAdapter<RewardsChallengeBean.RecordsBean> {

    List<RewardsChallengeBean.RecordsBean> mData = new ArrayList<>();
    Context mContext;

    public RewardsDetailsChallengeAdapter(Context context, List<RewardsChallengeBean.RecordsBean> data) {
        super(context, data);
        mContext = context;
        mData = data;
    }

    @Override
    protected void convert(BaseViewHolder holder, final RewardsChallengeBean.RecordsBean item, final int position) {
        TextView time = holder.getView(R.id.item_rewards_details_time);
        TextView title = holder.getView(R.id.item_rewards_details_title);
        TextView money = holder.getView(R.id.item_rewards_details_money);
        TextView number = holder.getView(R.id.item_rewards_details_number);
        time.setText(SysUtils.sf6.format(new Date(item.getDatetime())));
        title.setText(item.getMerchantName());
        number.setText("累计刷卡：" + StringUtil.getFormatPrice(item.getTradeAmount()) + "元");
        money.setText("+" + StringUtil.getFormatPrice(item.getAmount()) + "元");
        money.setTextColor(Color.parseColor("#F61414"));
        number.setTextColor(Color.parseColor("#333333"));
    }

    @Override
    protected int getItemViewLayoutId(int position, RewardsChallengeBean.RecordsBean item) {
        return R.layout.item_rewards_details;
    }

}
